package com.lagou.numsort;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class NumSortReducer extends Reducer<IntWritable,IntWritable,IntWritable,IntWritable> {

    private IntWritable nums = new IntWritable(1);

    @Override
    protected void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        for (IntWritable value : values) {
            context.write(nums,key);
            nums.set(nums.get()+1);
        }
    }
}
